import User from '../model/User';
import { APIError } from '../plugin/restful';

const NOT_FOUND = new APIError('user: not_found', '该用户不存在');

export const getUser = async (where: any) => {
  const user = <User | null> await User.findOne({ where });
  if (user === null) throw NOT_FOUND;
  return user;
};
